﻿using System;
using System.Collections.Generic;
 
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class per_login_password : MpageBase
{
    protected Model.CMember cmember = null;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void midifyBtn_Click(object sender, EventArgs e)
    {

        if (loginUserInfo != null && loginUserInfo.Id > 0)
        {
            cmember = BLL.CMember.GetModel(loginUserInfo.Id);
            if (cmember.u_password.Equals(BLL.Security.MD5(afterzhipass.Text.Trim())))
            {
                if (newpass.Text.Trim().Length < 6 || newpass.Text.Trim().Length > 20)
                {
                    alertmessageAndGoback("新密码的长度必须在6-20位之间！");
                }
                else
                {
                    cmember.u_password = BLL.Security.MD5(newpass.Text.Trim());
                    System.Web.HttpContext.Current.Session[BLL.CMember.LoginUserSessionKey] = cmember;
                    if (BLL.CMember.Update(cmember) > 0)
                    {
                        alertmessageAndGoback("新密码修改成功！");
                    }
                }
            }
            else
            {
                alertmessageAndGoback("原始密码错误！");
            }

        }
        else
        {
            alertmessageAndGoback("请重新登陆！");
        }
    }
}